// Copyright (c) 2022 Vuplex Inc. All rights reserved.
//
// Licensed under the Vuplex Commercial Software Library License, you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
//     https://vuplex.com/commercial-library-license
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import <UIKit/UIKit.h>
#import <Metal/Metal.h>
#import "UnityAppController.h"
#import "UnityInterface.h"

/**
* Extends UnityAppController to override shouldAttachRenderDelegate
* so that it can register a low-level rendering plugin.
*
* Unlike other platforms (like Desktop) where the plugin dynamic library is automatically
* loaded and registered by Unity, that must be done manually on iOS. VXWebViewAppController.mm uses Unity's
* IMPL_APP_CONTROLLER_SUBCLASS() macro to tell Unity to use VXWebViewAppController
* instead of UnityAppController. Due to a design flaw of Unity's plugin system for iOS, it's possible for
* multiple iOS plugins in a project to call IMPL_APP_CONTROLLER_SUBCLASS(), which results in one plugin's use
* of IMPL_APP_CONTROLLER_SUBCLASS() overwriting another's. For instructions on resolving such a conflict,
* please see this support article: https://support.vuplex.com/articles/ios-graphics-plugin-conflict
*/
@interface VXWebViewAppController : UnityAppController

/**
* Overrides [UnityAppController shouldAttachRenderDelegate]
* to hook into the Unity trampoline.
*/
- (void)shouldAttachRenderDelegate;

+ (id<MTLDevice>)metalDevice;

@end
